package com.designPatterns.singleton.client;

import com.designPatterns.singleton.LimitNumberInstance;
import com.designPatterns.singleton.SingletonEnum;
import com.designPatterns.singleton.SingletonInstantLoad;
import com.designPatterns.singleton.SingletonInstantLoadVariant;
import com.designPatterns.singleton.SingletonLazyLoad;
import com.designPatterns.singleton.SingletonLazyLoadDoubleCheck;
import com.designPatterns.singleton.SingletonLazyLoadEnhance;
import com.designPatterns.singleton.SingletonStaticInnerClass;

/**
 * Created by houjinxin on 16/3/5.
 */
public class NonConcurrentClient {

    public static void main(String[] args){

        //1.即时加载
//        SingletonInstantLoad.say();
//        SingletonInstantLoadVariant.say();

        //2.延迟加载
//        SingletonLazyLoad.say();
//        SingletonLazyLoad.getInstance();
//        SingletonLazyLoadEnhance.say();
//        SingletonLazyLoadEnhance.getInstance();

//        SingletonLazyLoadDoubleCheck.say();
//        SingletonLazyLoadDoubleCheck.getInstance();

//        SingletonStaticInnerClass.getInstance();
//        SingletonStaticInnerClass.say();

//        3.枚举单例
//        SingletonEnum.INSTANCE.say();

//        4.有上限的多例模式
//        LimitNumberInstance.getInstance();
        for (int i = 0; i < 100; i++){
            LimitNumberInstance instance = LimitNumberInstance.getInstance();
            instance.doSomething();
        }
    }
}
